package cn.virens.common.mapper.cursor;

import cn.virens.common.mapper.example.Example;
import cn.virens.common.mapper.example.mapper.ExampleProvider;
import io.mybatis.mapper.base.EntityProvider;
import io.mybatis.provider.Caching;
import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.cursor.Cursor;

public interface CursorMapper<T> {

    /**
     * 根据实体字段条件查询
     *
     * @param entity 实体类
     * @return 实体列表
     */
    @Lang(Caching.class)
    @SelectProvider(type = EntityProvider.class, method = "select")
    Cursor<T> selectCursor(T entity);

    /**
     * 根据 Example 条件查询
     *
     * @param example 条件
     * @return 实体列表
     */
    @Lang(Caching.class)
    @SelectProvider(type = ExampleProvider.class, method = "selectByExample")
    Cursor<T> selectCursorByExample(Example example);
}
